package org.mags.dao.common;

import java.util.ArrayList;
import java.util.List;

public class OrderBuilder {
	private List<SOrder> list = new ArrayList<SOrder>();
	@Override
	public String toString() {
		return list.toString();
	}
	public SOrder[] getOrder() {
		SOrder[] ordering = list.toArray(new SOrder[0]);
		list.clear();
		return ordering;
	}
	public OrderBuilder addOrder(Object property, DirectionOrder direction) {
		SOrder ordering = new SOrder(property, direction);
		list.add(ordering);
		return this;
	}
	public OrderBuilder() {
	}
	public static SOrder[] getOrder(Object property, DirectionOrder direction) {
		return new SOrder[]{new SOrder(property,direction)};
	}
}
